import 'package:flutter_ok/value/colours.dart';
import 'package:flutter_ok/widget/widget.dart';
import 'package:get/get.dart';

/// 加载框
class LoadingUtil {
  static void show({String text = '加载中...'}) {
    if (Get.isDialogOpen) {
      Get.back();
    }
    Get.dialog(
      LoadingDialog(
        text: text,
      ),
      barrierColor: Colours.barrier,
      barrierDismissible: false,
      useRootNavigator: false,
    );
  }

  static void dismiss() {
    if (Get.isDialogOpen) {
      Get.back();
    }
  }
}
